﻿<?php
	include '../inc/conn.php';
	session_start();
	extract($_POST);
	extract($_GET);
	unset($_POST,$_GET);
	
	if(!isset($_SESSION['logname'])){
		die("<div>User Session is missing</div>");
	}
	
	if (isset($act))
	{
		if (empty($imonth) || empty($ivalue)){
			echo "<script>alert('Some content must be filled in data!!');</script>";
			die("Some content must be filled in data!");
		}
		if ($act == 'mod')
		{	
			date_default_timezone_set('Asia/Shanghai');
			$dyear = date("Y");
			$db = new mysql();
			$table = "eng_kpi";
			$condition = "uid=$id and KPI_month=$imonth";
			$mod_content="KPI_total=$ivalue";
			$db->update($table, $mod_content, $condition);
			echo "<script>alert('Data changed!');window.opener.location.reload();window.close();</script>";
		}
	}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">-->
<link rel="stylesheet" href="/css/bootstrap.min.css">
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery-migrate.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<style>
<!--
.xheDialog label {
	display: inline;
}
.form-horizontal .control-label {
	width: 80px;
}
.form-horizontal .controls {
	margin-left: 20px;
}
-->
</style>
<title>修改绩效</title>
</head>
<body class="background">
<div class="container white-background pagecontent">
	<form action="mod_kpi.php?act=mod&id=<? echo $id ?>" method="post">
	<div>
		<div class="input-group">
            <span class="input-group-addon">年份</span>
            <input name="iyear" type="text" readonly="readonly" value="<? echo date("Y"); ?>" class="form-control">
            <span class="input-group-addon">月份</span>
            <input name="imonth" type="text" readonly="readonly" value="<? if (isset($imonth)) echo $imonth; else echo date("m"); ?>" class="form-control">
        </div>
		<div class="input-group">   
			<span class="input-group-addon">得分</span>
            <input name="ivalue" type="text" value="<? echo $ivalue; ?>" class="form-control">
		</div>
	<div><input class="btn btn-success btn-primary" name="submit" value="提交" type="submit"><input class="btn btn-danger" name="reset" value="重填" type="reset"></div>
	</div>
	</form>
</div>
</body>
</html>
